package com.education.mapper;

import com.education.domain.Tbscore;
import com.education.domain.TbscoreExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface TbscoreMapper {
    @SelectProvider(type=TbscoreSqlProvider.class, method="countByExample")
    int countByExample(TbscoreExample example);

    @DeleteProvider(type=TbscoreSqlProvider.class, method="deleteByExample")
    int deleteByExample(TbscoreExample example);

    @Delete({
        "delete from tbscore",
        "where lId = #{lid,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer lid);

    @Insert({
        "insert into tbscore (lStudentId, strStudentName, ",
        "lScore, lTestId, ",
        "lCourseId, lTeacherId, ",
        "lTermId, lClassId, ",
        "nGrade, nHalfTerm, ",
        "dtCreatTime, dtModifyTime)",
        "values (#{lstudentid,jdbcType=INTEGER}, #{strstudentname,jdbcType=VARCHAR}, ",
        "#{lscore,jdbcType=DOUBLE}, #{ltestid,jdbcType=INTEGER}, ",
        "#{lcourseid,jdbcType=INTEGER}, #{lteacherid,jdbcType=INTEGER}, ",
        "#{ltermid,jdbcType=INTEGER}, #{lclassid,jdbcType=INTEGER}, ",
        "#{ngrade,jdbcType=INTEGER}, #{nhalfterm,jdbcType=INTEGER}, ",
        "#{dtcreattime,jdbcType=TIMESTAMP}, #{dtmodifytime,jdbcType=TIMESTAMP})"
    })
    @Options(useGeneratedKeys=true,keyProperty="lid")
    int insert(Tbscore record);

    @InsertProvider(type=TbscoreSqlProvider.class, method="insertSelective")
    @Options(useGeneratedKeys=true,keyProperty="lid")
    int insertSelective(Tbscore record);

    @SelectProvider(type=TbscoreSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="lId", property="lid", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="lStudentId", property="lstudentid", jdbcType=JdbcType.INTEGER),
        @Result(column="strStudentName", property="strstudentname", jdbcType=JdbcType.VARCHAR),
        @Result(column="lScore", property="lscore", jdbcType=JdbcType.DOUBLE),
        @Result(column="lTestId", property="ltestid", jdbcType=JdbcType.INTEGER),
        @Result(column="lCourseId", property="lcourseid", jdbcType=JdbcType.INTEGER),
        @Result(column="lTeacherId", property="lteacherid", jdbcType=JdbcType.INTEGER),
        @Result(column="lTermId", property="ltermid", jdbcType=JdbcType.INTEGER),
        @Result(column="lClassId", property="lclassid", jdbcType=JdbcType.INTEGER),
        @Result(column="nGrade", property="ngrade", jdbcType=JdbcType.INTEGER),
        @Result(column="nHalfTerm", property="nhalfterm", jdbcType=JdbcType.INTEGER),
        @Result(column="dtCreatTime", property="dtcreattime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="dtModifyTime", property="dtmodifytime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<Tbscore> selectByExample(TbscoreExample example);

    @Select({
        "select",
        "lId, lStudentId, strStudentName, lScore, lTestId, lCourseId, lTeacherId, lTermId, ",
        "lClassId, nGrade, nHalfTerm, dtCreatTime, dtModifyTime",
        "from tbscore",
        "where lId = #{lid,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="lId", property="lid", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="lStudentId", property="lstudentid", jdbcType=JdbcType.INTEGER),
        @Result(column="strStudentName", property="strstudentname", jdbcType=JdbcType.VARCHAR),
        @Result(column="lScore", property="lscore", jdbcType=JdbcType.DOUBLE),
        @Result(column="lTestId", property="ltestid", jdbcType=JdbcType.INTEGER),
        @Result(column="lCourseId", property="lcourseid", jdbcType=JdbcType.INTEGER),
        @Result(column="lTeacherId", property="lteacherid", jdbcType=JdbcType.INTEGER),
        @Result(column="lTermId", property="ltermid", jdbcType=JdbcType.INTEGER),
        @Result(column="lClassId", property="lclassid", jdbcType=JdbcType.INTEGER),
        @Result(column="nGrade", property="ngrade", jdbcType=JdbcType.INTEGER),
        @Result(column="nHalfTerm", property="nhalfterm", jdbcType=JdbcType.INTEGER),
        @Result(column="dtCreatTime", property="dtcreattime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="dtModifyTime", property="dtmodifytime", jdbcType=JdbcType.TIMESTAMP)
    })
    Tbscore selectByPrimaryKey(Integer lid);

    @UpdateProvider(type=TbscoreSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") Tbscore record, @Param("example") TbscoreExample example);

    @UpdateProvider(type=TbscoreSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") Tbscore record, @Param("example") TbscoreExample example);

    @UpdateProvider(type=TbscoreSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Tbscore record);

    @Update({
        "update tbscore",
        "set lStudentId = #{lstudentid,jdbcType=INTEGER},",
          "strStudentName = #{strstudentname,jdbcType=VARCHAR},",
          "lScore = #{lscore,jdbcType=DOUBLE},",
          "lTestId = #{ltestid,jdbcType=INTEGER},",
          "lCourseId = #{lcourseid,jdbcType=INTEGER},",
          "lTeacherId = #{lteacherid,jdbcType=INTEGER},",
          "lTermId = #{ltermid,jdbcType=INTEGER},",
          "lClassId = #{lclassid,jdbcType=INTEGER},",
          "nGrade = #{ngrade,jdbcType=INTEGER},",
          "nHalfTerm = #{nhalfterm,jdbcType=INTEGER},",
          "dtCreatTime = #{dtcreattime,jdbcType=TIMESTAMP},",
          "dtModifyTime = #{dtmodifytime,jdbcType=TIMESTAMP}",
        "where lId = #{lid,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Tbscore record);
}